<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<input type="file" name="" id="f" value="" />
		<button onclick="read()">读取</button>
		<pre id="r" style="border: 1px solid #ccc; width: 500px;min-height: 200px;">
			
		</pre>
	</body>
</html>

<script type="text/javascript">
	function read(){
		let file = document.getElementById("f").files[0];
		console.log(file);
		let reader = new FileReader();
		reader.readAsText(file);
		reader.onload=function(e){
			console.log(reader)
			document.getElementById("r").innerHTML=reader.result;
			window.fblob = new Blob([e.target.result],{type:file.type});
		};
	}
</script>
